package ua.com.minus1.lookbattle.net;

/**
 * Created by IntelliJ IDEA.
 * Date: 22.05.12
 * Time: 15:12
 * To change this template use File | Settings | File Templates.
 */
public class URLManager {



    public static final String BASE_URL = "http://lookbattle.minus1.com.ua/";

    public static final String START_URL = "start.php";
    public static final String GET_PAIR_URL = "get_pair.php";
    public static final String MY_LOOKS_URL = "get_looks.php";
    public static final String REGISTER_URL = "register.php";
    public static final String UPLOAD_LOOK_URL = "upload_look.php";
    private static final String LOOK_INFO_URL = "get_look.php";
    private static final String BONUS_UP_URL = "bonus_up.php";
    private static final String DELETE_LOOK_URL = "delete_look.php";
    private static final String SEND_CODE_URL = "send_code.php";
    private static final String CONFIRM_CODE_URL = "confirm_code.php";
    private static final String BONUS_REFUND_URL = "bonus_refund.php";

    private static final String PROP_SESSION = "sid";
    private static final String PROP_SELECTION = "sel";
    private static final String PROP_CAT = "c";
    private static final String PROP_UID = "aid";
    private static final String PROP_WIDTH = "w";
    private static final String PROP_HEIGHT = "h";
    private static final String PROP_NICK = "nick";
    private static final String PROP_EMAIL = "email";
    private static final String PROP_LOOK_ID = "lid";
    private static final String PROP_CODE = "code";

    private static final String PROP_BONUSES = "b";
    public static final int IMAGE_RIGHT = 1;
    public static final int IMAGE_LEFT = 2;

    public static final int IMAGE_SKIP = 0;



    public static String getStartUrl(String uuid, int width, int height) {
        return BASE_URL + START_URL + "?" + HttpManager.getParamsString(PROP_UID, uuid, PROP_WIDTH, String.valueOf(width), PROP_HEIGHT, String.valueOf(height));
    }


    public static String getImagesURL(String userId, int cat) {
        return BASE_URL + GET_PAIR_URL + "?" + HttpManager.getParamsString(PROP_UID, userId, PROP_CAT, String.valueOf(cat));
    }

    public static String getImagesURL(String userId, int cat, String sessionId, int imageId) {
        return BASE_URL + GET_PAIR_URL + "?" + HttpManager.getParamsString(PROP_UID, userId, PROP_CAT, String.valueOf(cat), PROP_SESSION, sessionId, PROP_SELECTION, String.valueOf(imageId));
    }

    public static String getMyLooksURL(String userId, int cat) {
        return BASE_URL + MY_LOOKS_URL + "?" + HttpManager.getParamsString(PROP_UID, userId, PROP_CAT, String.valueOf(cat));
    }

    public static String getLookInfoURL(String userId, int cat, int lid) {
        return BASE_URL + LOOK_INFO_URL + "?" + HttpManager.getParamsString(PROP_UID, userId, PROP_CAT, String.valueOf(cat), PROP_LOOK_ID, String.valueOf(lid));
    }

    public static String getRegisterURL(String userId, String email, String username) {
        return BASE_URL + REGISTER_URL + "?" + HttpManager.getParamsString(PROP_UID, userId, PROP_NICK, username, PROP_EMAIL, email);
    }

    public static String getUploadLookURL() {
        return BASE_URL + UPLOAD_LOOK_URL;
    }

    public static String getBonusUpUrl(String uuid, int catId, int lookId, int addedBonuses) {
        return BASE_URL + BONUS_UP_URL + "?" + HttpManager.getParamsString(PROP_UID, uuid, PROP_CAT, String.valueOf(catId), PROP_LOOK_ID, String.valueOf(lookId), PROP_BONUSES, String.valueOf(addedBonuses));
    }

    public static String getBonusRefundUrl(String uuid, int catId, int lookId, int addedBonuses) {
        return BASE_URL + BONUS_REFUND_URL + "?" + HttpManager.getParamsString(PROP_UID, uuid, PROP_CAT, String.valueOf(catId), PROP_LOOK_ID, String.valueOf(lookId), PROP_BONUSES, String.valueOf(addedBonuses));
    }

    public static String getDeleteLookURL(String uuid, int lookId, int catId) {
        return BASE_URL + DELETE_LOOK_URL + "?" + HttpManager.getParamsString(PROP_UID, uuid, PROP_LOOK_ID, String.valueOf(lookId), PROP_CAT, String.valueOf(catId));
    }

    public static String getSendCodeURL(String uuid, String email) {
        return BASE_URL + SEND_CODE_URL + "?" + HttpManager.getParamsString(PROP_UID, uuid, PROP_EMAIL, email);
    }

    public static String getConfirmCode(String uuid, String code) {
        return BASE_URL + CONFIRM_CODE_URL + "?" + HttpManager.getParamsString(PROP_UID, uuid, PROP_CODE, code);
    }
}
